package com.codeZ.SingletonPattern;

/**
 * @Author code_zhang
 * @Date 2024/6/15 16:04
 * 单例模式 - 静态内部类
 * 优点: 线程安全 懒加载
 * 缺点:在某些情况下可能导致类加载器泄露
 */
public class SingletonPattern05 {

    private SingletonPattern05(){}

    private static class SingletonPattern05Holder{
        private static final SingletonPattern05 INSTANCE = new SingletonPattern05();
    }

    public static SingletonPattern05 getInstance(){
        return SingletonPattern05Holder.INSTANCE;
    }


}